<xsl:stylesheet version="1.1"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns="http://www.w3.org/2000/svg">
                <!-- exists(.//type[@name='blob']) [exists(type[@name='acidblob'])]-->
  <xsl:import href="../types-to-classes.xslt"/>

  <xsl:template match="part[type//@name='blob']" mode="render">
    <xsl:param name="state" select="@state"/>
    
    <xsl:variable name="scale-values">
      <xsl:choose>
        <xsl:when test="$state = 'walking'">1.1;0.7;1.1</xsl:when>
        <xsl:otherwise>1;0.75;1</xsl:otherwise>
      </xsl:choose>
    </xsl:variable>
    
    <g>
      <desc><xsl:value-of select="type/@name"/><xsl:text> </xsl:text><xsl:value-of select="$state"/></desc>
      <defs>
        <radialGradient id="blob-color" gradientUnits="objectBoundingBox"
                      cx="0.7" cy="0.2" r="0.6" fx="0.7" fy="0.2">
          <stop offset="0%">
	        <xsl:attribute name="class">
			  <xsl:apply-templates select="type" mode="to-classes">
			    <xsl:with-param name="postfix">-body-gradient-stop-inner</xsl:with-param>
			  </xsl:apply-templates>
	        </xsl:attribute>
          </stop>
          <stop offset="100%">
	        <xsl:attribute name="class">
			  <xsl:apply-templates select="type" mode="to-classes">
			    <xsl:with-param name="postfix">-body-gradient-stop-outer</xsl:with-param>
			  </xsl:apply-templates>
	        </xsl:attribute>          
          </stop>
        </radialGradient>
      </defs>
      <path 
        fill="url(#blob-color)" 
        d="M-5,1.5 C-5,-4.5 5,-4.5 5,1.5 M5,1.5 C5,4.5 -5,4.5 -5,1.5" 
        id="grab-point">
        <xsl:attribute name="class">
		  <xsl:apply-templates select="type" mode="to-classes">
		    <xsl:with-param name="postfix">-body</xsl:with-param>
		  </xsl:apply-templates>
        </xsl:attribute>
      </path>
      <animateTransform attributeName="transform" type="scale" additive="replace" dur="1s" fill="freeze" repeatCount="indefinite">
        <xsl:attribute name="values"><xsl:value-of select="$scale-values"/></xsl:attribute>
      </animateTransform>
    </g>
  </xsl:template>
</xsl:stylesheet>